package com.zeroup.auto.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.zeroup.auto.MainActivity;
import com.zeroup.auto.service.DelayBootService;

import java.util.Objects;

public class BootBroadcastReceiver extends BroadcastReceiver {
    static final String ACTION = "android.intent.action.BOOT_COMPLETED";

    @Override
    public void onReceive(Context context, Intent intent)
    {
        Log.i("test - 广播启动","启动了,开启游戏管理器.");
        if (Objects.equals(intent.getAction(), ACTION)){
//            Intent it = new Intent(context, MainActivity.class);
//            it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//            context.startActivity(it);
            // 在此处启动系统服务
            Intent serviceIntent = new Intent(context, DelayBootService.class);
            context.startService(serviceIntent);
        }
    }
}
